//package com.jc.dao.busi.impl;
//
//import com.jc.base.Assert;
//import com.jc.base.ComponentException;
//import com.jc.base.page.Page;
//import com.jc.base.ResultData;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import com.google.common.collect.Lists;
//import com.jc.dao.busi.SetSaleInfoDao;
//import com.jc.domain.busi.SetSaleInfo;
//import com.jc.domain.busi.SetSaleInfoConditions;
//import com.jc.mapper.busi.SetSaleInfoMapper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Repository;
//import org.springframework.transaction.annotation.Transactional;
//
//import com.jc.repository.generator.utils.GenerateMybaitsUtils;
//import com.jc.repository.generator.utils.Condition;
//import com.jc.repository.generator.utils.ConditionsExtend;
//import com.jc.utils.CollectionUtils;
//
//import java.util.List;
//import java.util.ArrayList;
//
///**
// * @author
// * @create 2016-12-13 09:32:26
// * @description
// */
//
//@Repository
//public class SetSaleInfoDaoImpl implements SetSaleInfoDao {
//
//    private static final Logger LOGGER = LoggerFactory.getLogger(SetSaleInfoDaoImpl.class);
//
//    @Autowired
//    private SetSaleInfoMapper mapper;
//
//    //this function automatic generated by application
//    @Override
//    public SetSaleInfo querySetSaleInfoById(Long id) {
//
//        Assert.notNull(id, "用于查询的id不能为空");
//        return mapper.selectByPrimaryKey(id);
//    }
//
//    //this function automatic generated by application
//    @Override
//    public ResultData<List<SetSaleInfo>> querySetSaleInfosByConditions(SetSaleInfo setSaleInfo, String orderByClause, Page page) {
//
//        ResultData<List<SetSaleInfo>> res = new ResultData<>();
//        if(null == setSaleInfo && LOGGER.isInfoEnabled()){
//            LOGGER.info("用于查询的条件为空, 将查询setSaleInfo表的所有数据");
//        }
//        SetSaleInfoConditions conditions = new SetSaleInfoConditions();
//
//        SetSaleInfoConditions.Criteria criteria = conditions.or();
//
//        GenerateMybaitsUtils.buildConditionsByReflect(criteria, setSaleInfo);
//
//        if (null != page) {
//            conditions.setPage(page);
//            page.setTotalNum(mapper.countByExample(conditions));
//            res.setPage(page);
//        }
//
//        if (null != orderByClause) {
//            conditions.setOrderByClause(orderByClause);
//        }
//
//        res.setData(mapper.selectByExample(conditions));
//        return res;
//    }
//
//    //this function automatic generated by application
//    @Override
//    public List<SetSaleInfo> querySetSaleInfosByConditions(SetSaleInfo setSaleInfo, String orderByClause){
//
//        if(null == setSaleInfo && LOGGER.isInfoEnabled()){
//        	LOGGER.info("用于查询的条件为空, 将查询setSaleInfo表的所有数据");
//        }
//        SetSaleInfoConditions conditions = new SetSaleInfoConditions();
//
//        SetSaleInfoConditions.Criteria criteria = conditions.or();
//
//        GenerateMybaitsUtils.buildConditionsByReflect(criteria, setSaleInfo);
//
//        if (null != orderByClause) {
//            conditions.setOrderByClause(orderByClause);
//        }
//
//        return mapper.selectByExample(conditions);
//    }
//
//    //this function automatic generated by application
//    @Override
//    public List<SetSaleInfo> querySetSaleInfosByConditionEx(SetSaleInfo setSaleInfo, String orderByClause, Condition condition) {
//
//        Assert.notNull(setSaleInfo, "用于查询的类,不能为空");
//        SetSaleInfoConditions conditions = new SetSaleInfoConditions();
//
//        SetSaleInfoConditions.Criteria criteria = conditions.or();
//        GenerateMybaitsUtils.buildConditionEx(criteria,setSaleInfo,condition);
//
//        if (null != orderByClause) {
//            conditions.setOrderByClause(orderByClause);
//        }
//
//        return mapper.selectByExample(conditions);
//
//    }
//
//    //this function automatic generated by application
//    @Override
//    public List<SetSaleInfo> querySetSaleInfosByConditionExs(ConditionsExtend conditionsExtend, String orderByClause) {
//        Assert.notNull(conditionsExtend, "用于查询的类,不能为空");
//        SetSaleInfoConditions conditions = new SetSaleInfoConditions();
//
//        SetSaleInfoConditions.Criteria criteria = conditions.or();
//
//        GenerateMybaitsUtils.buildConditionExs(criteria, conditionsExtend);
//
//        if (null != orderByClause) {
//            conditions.setOrderByClause(orderByClause);
//        }
//
//        return mapper.selectByExample(conditions);
//    }
//
//    //this function automatic generated by application
//    @Override
//    public SetSaleInfo saveOrInsert(SetSaleInfo setSaleInfo) {
//
//        Assert.notNull(setSaleInfo, "用于保存的对象不能为空");
//
//        GenerateMybaitsUtils.checkNotNull(setSaleInfo);
//
//        if (null != setSaleInfo.getId()) {
//            Assert.notNull(setSaleInfo.getId(), "用于更新的对象id不能为空");
//            mapper.updateByPrimaryKeySelective(setSaleInfo);
//        } else {
//            mapper.insertSelective(setSaleInfo);
//        }
//        return setSaleInfo;
//
//    }
//
//    //this function automatic generated by application
//    @Transactional
//    @Override
//    public List<SetSaleInfo> saveOrInsertList(List<SetSaleInfo> setSaleInfos) {
//
//        Assert.isTrue(CollectionUtils.isNotEmpty(setSaleInfos), "添加的setSaleInfo集合禁止为空");
//        ArrayList<SetSaleInfo> setSaleInfosSaved = Lists.newArrayListWithCapacity(setSaleInfos.size());
//
//        for (SetSaleInfo setSaleInfo:setSaleInfos) {
//            setSaleInfosSaved.add(saveOrInsert(setSaleInfo));
//        }
//        return setSaleInfosSaved;
//    }
//
//    //this function automatic generated by application
//    @Override
//    public boolean deleteSetSaleInfoById(Long id) {
//
//        Assert.notNull(id, "属性id不能为空");
//        boolean result = false;
//        try {
//             result =  mapper.deleteByPrimaryKey(id) > 0;
//        } catch (Exception e) {
//            throw new ComponentException(ComponentException.ErrCode.系统异常,"插入异常");
//        }
//        return result;
//    }
//
//    //this function automatic generated by application
//    @Override
//    public void deleteByConditions(SetSaleInfo setSaleInfo) {
//        Assert.notNull(setSaleInfo, "构造删除条件的类不能为空");
//
//        SetSaleInfoConditions conditions = new SetSaleInfoConditions();
//
//        SetSaleInfoConditions.Criteria criteria = conditions.or();
//
//        GenerateMybaitsUtils.buildConditionsByReflect(criteria,setSaleInfo);
//        mapper.deleteByExample(conditions);
//
//    }
//
//
//}